/*    */ package eos.moe.dragoncore;
/*    */ 
/*    */ import java.util.List;
/*    */ import java.util.regex.Matcher;
/*    */ import java.util.regex.Pattern;
/*    */ import net.minecraft.client.renderer.GlStateManager;
/*    */ import net.minecraft.nbt.NBTBase;
/*    */ import net.minecraft.nbt.NBTTagCompound;
/*    */ import net.minecraft.nbt.NBTTagString;
/*    */ import org.yaml.snakeyamla.configuration.ConfigurationSection;
/*    */ 
/*    */ 
/*    */ public class sx
/*    */   extends gy
/*    */ {
/*    */   private boolean z;
/*    */   private float i;
/*    */   private String w;
/*    */   private boolean q;
/*    */   
/*    */   public sx(ConfigurationSection configurationSection) {
/* 22 */     super(configurationSection);
/* 23 */     this.z = configurationSection.getBoolean("center");
/* 24 */     this.i = (float)configurationSection.getDouble("size", 1.0D);
/* 25 */     this.w = configurationSection.getString("text", "未配置文本").replace("&", "§");
/* 26 */     this.q = configurationSection.getBoolean("shadow", true);
/*    */   }
/*    */ 
/*    */ 
/*    */   
/*    */   public void v() {
/* 32 */     GlStateManager.func_179094_E();
/* 33 */     String str = z();
/* 34 */     GlStateManager.func_179137_b(z(), v(), 0.0D);
/* 35 */     GlStateManager.func_179152_a(this.i, this.i, this.i);
/* 36 */     if (this.z) {
/* 37 */       (v()).s.func_175065_a(str, -(v()).s.func_78256_a(str) / 2.0F, 0.0F, -1, this.q);
/*    */     } else {
/* 39 */       (v()).s.func_175065_a(str, 0.0F, 0.0F, -1, this.q);
/*    */     } 
/* 41 */     GlStateManager.func_179121_F();
/*    */   }
/*    */   
/*    */   public String z() {
/* 45 */     if (!this.w.contains("%")) return this.w; 
/* 46 */     String str = this.w;
/* 47 */     List<String> list = ve.z((v()).m);
/*    */     
/* 49 */     str = str.replace("%name%", (v()).m.func_82833_r());
/* 50 */     if (str.contains("%lore_") || str.contains("%nbt_")) {
/* 51 */       Matcher matcher = g.matcher(str);
/* 52 */       while (matcher.find()) {
/* 53 */         String str1 = matcher.group(0);
/* 54 */         int i = str1.indexOf("_");
/* 55 */         if (i != -1) {
/* 56 */           if (str1.startsWith("%lore")) {
/* 57 */             int j = v(str1.substring(i + 1, str1.length() - 1));
/* 58 */             if (j < list.size()) {
/* 59 */               str = str.replaceAll(Pattern.quote(matcher.group()), Matcher.quoteReplacement(list.get(j))); continue;
/*    */             } 
/* 61 */             str = str.replaceAll(Pattern.quote(matcher.group()), ""); continue;
/*    */           } 
/* 63 */           if (str1.startsWith("%nbt") && (v()).m.func_77978_p() != null) {
/* 64 */             String[] arrayOfString = str1.substring(5, str1.length() - 1).split("\\.");
/* 65 */             NBTTagCompound nBTTagCompound = (v()).m.func_77978_p();
/* 66 */             for (int j = 0; j < arrayOfString.length - 1; j++) {
/* 67 */               nBTTagCompound = nBTTagCompound.func_74775_l(arrayOfString[j]);
/*    */             }
/* 69 */             if (arrayOfString.length > 0) {
/* 70 */               NBTBase nBTBase = nBTTagCompound.func_74781_a(arrayOfString[arrayOfString.length - 1]);
/* 71 */               if (nBTBase != null) {
/* 72 */                 if (nBTBase.func_74732_a() == 8) {
/* 73 */                   str = str.replaceAll(Pattern.quote(matcher.group()), Matcher.quoteReplacement(((NBTTagString)nBTBase).func_150285_a_())); continue;
/*    */                 } 
/* 75 */                 str = str.replaceAll(Pattern.quote(matcher.group()), Matcher.quoteReplacement(nBTBase.toString()));
/*    */               } 
/*    */             } 
/*    */           } 
/*    */         } 
/*    */       } 
/*    */     } 
/*    */     
/* 83 */     str = tja.v(str);
/* 84 */     return str;
/*    */   }
/*    */   
/* 87 */   private static final Pattern g = Pattern.compile("[%]([^%]+)[%]");
/*    */   
/*    */   public static int v(String a) {
/*    */     try {
/* 91 */       return Integer.parseInt(a);
/* 92 */     } catch (Exception exception) {
/* 93 */       return 0;
/*    */     } 
/*    */   }
/*    */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\eos\moe\dragoncore\sx.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */